package newfeature.jdk9;

import java.util.List;
import java.util.Set;

/**
 * Created by dl
 */
public class ImmutableCollectionFactoryMethod {
	public static void main(String[] args) {
		List<Integer> integerList = List.of(3, 2, 2, 1);
		System.out.println("integerList = " + integerList);
		Set<Integer> integerSet = Set.of(3, 2, 2, 1);        // immutable set
		System.out.println("integerSet = " + integerSet);
		List<Integer> integerListCopy = List.copyOf(integerSet);    // immutable list
		System.out.println("integerListCopy = " + integerListCopy);
		// may NOT mutate
		// list.add()   ERR
		// integerListCopy.add()  ERR
	}

}
